﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tutorials;
using Lxzhu.OpenGL;
namespace Tutorials.PrimitiveTriangles
{
    class Program:TimedGlutEngine
    {
        static void Main(string[] args)
        {
            Program rt = new Program() { Interval=1000};
            rt.Run();
        }
        private void glBegin()
        {
            switch (this.TotalFrames % 3)
            {
                case 0: Gl.glBegin(PrimitiveType.GL_TRIANGLES); break;
                case 1: Gl.glBegin(PrimitiveType.GL_TRIANGLE_STRIP); break;
                case 2: Gl.glBegin(PrimitiveType.GL_TRIANGLE_FAN); break;
            }
        }
        public override void OnDisplay()
        {
            Gl.glClear(BufferBit.GL_COLOR_BUFFER_BIT);
            Gl.glClearColor(0, 0, 0, 0);
            glBegin();
            Gl.glColor(1,0,0);
            Gl.glVertex(-0.75, -0.5);
            Gl.glColor(1, 1, 0);
            Gl.glVertex(0, -0.5);
            Gl.glColor(1, 1, 1);
            Gl.glVertex(-0.5, 0);
            Gl.glColor(0, 1, 0);
            Gl.glVertex(0, 0);
            Gl.glColor(0, 1, 1);
            Gl.glVertex(0.5, 0.5);
            Gl.glColor(0, 0, 1);
            Gl.glVertex(-0.25, 0.75);
            Gl.glEnd();
        }

    }
}
